using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using MAPDavy.Entities;

namespace MAPDavy.Repository.Mapping
{
	public class ColorCodeMap : EntityTypeConfiguration<ColorCode>
	{
		public ColorCodeMap()
		{
			// Primary Key
			this.HasKey(t => t.Id);

			// Properties
			this.Property(t => t.ColorName)
				.IsRequired()
				.HasMaxLength(50);
				
			this.Property(t => t.HexCode)
				.HasMaxLength(50);
				
			this.Property(t => t.RGBCode)
				.HasMaxLength(50);
				
			this.Property(t => t.ColorTextName)
				.HasMaxLength(50);
				
			this.Property(t => t.HexCodeText)
				.HasMaxLength(50);
				
			this.Property(t => t.RGBCodeText)
				.IsFixedLength()
				.HasMaxLength(10);
				
			this.Property(t => t.Descripcion)
				.HasMaxLength(250);
				
			// Table & Column Mappings
			this.ToTable("ColorCode");
			this.Property(t => t.Id).HasColumnName("Id");
			this.Property(t => t.ColorName).HasColumnName("ColorName");
			this.Property(t => t.HexCode).HasColumnName("HexCode");
			this.Property(t => t.RGBCode).HasColumnName("RGBCode");
			this.Property(t => t.ColorTextName).HasColumnName("ColorTextName");
			this.Property(t => t.HexCodeText).HasColumnName("HexCodeText");
			this.Property(t => t.RGBCodeText).HasColumnName("RGBCodeText");
			this.Property(t => t.Descripcion).HasColumnName("Descripcion");
		}
	}
}

